package com.imooc.coupon.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/** 产品线枚举 天猫 淘宝
 * @description:
 * @author：naxiaozi，微信：naxiaozi
 * @date: 2025/8/10
 * @Copyright：
 */
@Getter
@AllArgsConstructor
public enum ProductLine {
    DAMAO("大猫",1),

    DABAO("大宝",2);
    /**
     * 产品线描述
     */
    private String desctiption;
    /**
     * 产品线编码
     */
    private Integer code;

    public static ProductLine of(Integer code){

        Objects.requireNonNull(code);
        return Stream.of(values()).filter(bean->bean.getCode().equals(code))
                .findAny()
                .orElseThrow(()->new IllegalArgumentException(code+" not exists"));
    }


}
